package com.yl.auth.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yl.auth.entity.Renwujiaojie;
import com.yl.auth.entity.Renwukanban;
import com.yl.auth.model.vo.CwgenghuanVo;
import com.yl.auth.service.RenwukanbanService;
import com.yl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Calendar;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ln
 * @since 2023-07-14
 */
@RestController
@RequestMapping("/admin/renwukanban")
@Api(tags = "任务看板")
public class RenwukanbanController {
    @Resource
    private RenwukanbanService renwukanbanService;
    @GetMapping("/getrenwukanban/{page}/{limit}")
    @ApiOperation(value = "任务看板")
    public Result getrenwukanban( @PathVariable Long page,
                                  @PathVariable Long limit,String hname, Integer zhuangtai){
        Page<Renwukanban> pageParam = new Page<>(page,limit);
        Page<Renwukanban> pageVo = renwukanbanService.getrenwukanbans(pageParam, hname, zhuangtai);
        return Result.ok(pageVo);
    }
    @PostMapping("/addrenwukanban")
    @ApiOperation("添加任务")
    public Result add(Renwukanban renwukanban){
        renwukanbanService.save(renwukanban);
        return Result.ok();
    }
    @GetMapping("/getrenwukanbanById/{id}")
    @ApiOperation(value = "任务看板详情")
    public Result getrenwukanbanById( @PathVariable Integer id){
       Renwukanban pageVo = renwukanbanService.getrenwukanbanById(id);
        return Result.ok(pageVo);
    }
    @GetMapping("/getrenwukanbanByzhuangtai/{zhuangtai}")
    @ApiOperation(value = "任务看板详情")
    public Result getrenwukanbanByzhuangtai( @PathVariable Integer zhuangtai){
        List<Renwukanban> pageVo = renwukanbanService.getrenwukanbanByzhuangtai(zhuangtai);
        return Result.ok(pageVo);
    }
    @GetMapping("/gethg")
    @ApiOperation(value = "获取全部护工")
    public Result gethg(){
        List<Renwukanban> pageVo = renwukanbanService.gethg();
        return Result.ok(pageVo);
    }

}

